package cn.edu.gues.infosystam.controller;


import cn.edu.gues.infosystam.entity.Cclass;
import cn.edu.gues.infosystam.service.CclassService;
import cn.edu.gues.infosystam.utils.R;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 苏小小
 * @since 2020-06-11
 */
@RestController
@RequestMapping("/Cclass")
public class CclassController {

    @Autowired
    private CclassService cclassService;

    @ResponseBody
    @PostMapping("getCollege")
    public R getClassByCollege(String college){
        QueryWrapper<Cclass> queryWrapper = new QueryWrapper<Cclass>();

        queryWrapper.eq("college", college).eq("deleted",0);
        List<Cclass> cclassList = cclassService.list(queryWrapper);
        if (cclassList != null)
            return R.success().data("college",cclassList);
        return R.error();
    }
}

